package com.yy.bolg.controller.feedback;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.yy.bolg.constant.ResultCode;
import com.yy.bolg.entity.CustomerBean;
import com.yy.bolg.entity.FeedbackBean;
import com.yy.bolg.request.FeedbackRequest;
import com.yy.bolg.resp.*;
import com.yy.bolg.service.CustomerService;
import com.yy.bolg.service.FeedbackService;
import com.yy.bolg.util.CodeGenerateUtil;
import com.yy.bolg.util.DateUtil;
import com.yy.bolg.util.RespenseJsonTransformationUtil;
import com.yy.bolg.ws.WebSocket;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 上报故障/预警控制器
 * @author enmaoFu
 * @date 2024-11-02
 * RequestMapping("/feedback") 是说明这个类的访问地址是 /feedback
 */
@Api(tags = {"上报故障/预警"})
@Controller
@RequestMapping(value = "/feedback")
public class FeedbackController {

    @Autowired
    private FeedbackService service;// 自动载入Service对象

    @Autowired
    private CustomerService customerService;// 自动载入Service对象

    @Autowired
    private WebSocket webSocket;// 自动载入Service对象

    /**
     * 上报
     * 服务器访问路径：http://localhost:8080/bolg/feedback/submit
     * 本地访问路径：http://localhost:8111/feedback/submit
     * 参数：feedbackVoiceFile、feedbackVideoFile可空
     * {"psCustomerCode":"CUS20241102102456","feedbackContent":"测试上报内容","feedbackVoiceFile":"音频路径","feedbackVideoFile":"视频路径","feedbackImgFile":"图片路径","feedbackProvince":"重庆市","feedbackCity":"重庆市","feedbackRegion":"渝北区","feedbackAddress":"地址地址地址","feedbackLongitude":23.12312,"feedbackLatitude":103.123,"feedbackType":2}
     */
    @ApiOperation(value = "上报", notes = "参数：{\"psCustomerCode\":\"CUS20241102102456\",\"feedbackContent\":\"测试上报内容\",\"feedbackVoiceFile\":\"音频路径\",\"feedbackVideoFile\":\"视频路径\",\"feedbackImgFile\":\"图片路径\",\"feedbackProvince\":\"重庆市\",\"feedbackCity\":\"重庆市\",\"feedbackRegion\":\"渝北区\",\"feedbackAddress\":\"地址地址地址\",\"feedbackLongitude\":23.12312,\"feedbackLatitude\":103.123,\"feedbackType\":2}")
    @RequestMapping(value = "/submit",method = RequestMethod.POST, produces="text/html;charset=UTF-8")
    @ResponseBody
    public String submit(@RequestBody FeedbackRequest request){
        String result;

        try {
            CustomerBean customerBean = new CustomerBean();
            customerBean.setPsCustomerCode(request.getPsCustomerCode());
            CustomerBean returnCustomerBean = customerService.findOneByCode(customerBean);
            if(returnCustomerBean.getPsCustomerState() == 2){
                FeedbackBean feedbackBean = new FeedbackBean();
                feedbackBean.setPsFeedbackCode(CodeGenerateUtil.getFeedbackCode());
                feedbackBean.setPsCustomerCode(request.getPsCustomerCode());
                feedbackBean.setPsFeedbackContent(request.getFeedbackContent());
                feedbackBean.setPsFeedbackVoiceFile(request.getFeedbackVoiceFile());
                feedbackBean.setPsFeedbackVideoFile(request.getFeedbackVideoFile());
                feedbackBean.setPsFeedbackImgFile(request.getFeedbackImgFile());
                feedbackBean.setPsFeedbackProvince(request.getFeedbackProvince());
                feedbackBean.setPsFeedbackCity(request.getFeedbackCity());
                feedbackBean.setPsFeedbackRegion(request.getFeedbackRegion());
                feedbackBean.setPsFeedbackAddress(request.getFeedbackAddress());
                feedbackBean.setPsFeedbackLongitude(request.getFeedbackLongitude());
                feedbackBean.setPsFeedbackLatitude(request.getFeedbackLatitude());
                feedbackBean.setPsFeedbackType(request.getFeedbackType());
                feedbackBean.setPsFeedbackState(1);
                feedbackBean.setPsFeedbackClassification(2);
                feedbackBean.setPsFeedbackGlance(1);
                feedbackBean.setPsFeedbackGlanceServer(1);

                service.add(feedbackBean);
                result = RespenseJsonTransformationUtil.jsonStr(ResultCode.CODE_SUCCESS, "上报成功", new HashMap());

                webSocket.sendMessageAll(result);
            }else{
                if(returnCustomerBean.getPsCustomerState() == 1){
                    result = RespenseJsonTransformationUtil.jsonStr(ResultCode.CODE_FAIL, "审核中", new HashMap());
                }else if(returnCustomerBean.getPsCustomerState() == 3){
                    result = RespenseJsonTransformationUtil.jsonStr(ResultCode.CODE_FAIL, "审核未通过", new HashMap());
                }else{
                    result = RespenseJsonTransformationUtil.jsonStr(ResultCode.CODE_FAIL, "未知错误", new HashMap());
                }
            }
        } catch (Exception e) {
            e.printStackTrace();
            result = RespenseJsonTransformationUtil.jsonStr(ResultCode.CODE_FAIL, e.getMessage(),new HashMap());
        }
        return result;
    }

    /**
     * 删除上报
     * 服务器访问路径：http://localhost:8080/bolg/feedback/delete
     * 本地访问路径：http://localhost:8111/feedback/delete
     * 参数：
     * {"feedbackCode":"FEED20241102142035"}
     */
    @ApiOperation(value = "删除上报", notes = "参数：{\"feedbackCode\":\"FEED20241102142035\"}")
    @RequestMapping(value = "/delete",method = RequestMethod.POST,produces="text/html;charset=UTF-8")
    @ResponseBody
    public String delete(@RequestBody FeedbackRequest request){
        String result;

        FeedbackBean feedbackBean = new FeedbackBean();
        feedbackBean.setPsFeedbackCode(request.getFeedbackCode());

        try {
            service.del(feedbackBean);
            result = RespenseJsonTransformationUtil.jsonStr(ResultCode.CODE_SUCCESS, "删除成功", new HashMap());
        } catch (Exception e) {
            e.printStackTrace();
            result = RespenseJsonTransformationUtil.jsonStr(ResultCode.CODE_FAIL, e.getMessage(),new HashMap());
        }
        return result;
    }

    /**
     * 上报状态更改
     * 服务器访问路径：http://localhost:8080/bolg/feedback/stateUp
     * 本地访问路径：http://localhost:8111/feedback/stateUp
     * 参数：
     * {"feedbackCode":"CUS20241102102456","feedbackState": 1,"feedbackRemarks":"驳回原因测试"}
     */
    @ApiOperation(value = "上报状态更改", notes = "参数：{\"feedbackCode\":\"CUS20241102102456\",\"feedbackState\": 1,\"feedbackRemarks\":\"驳回原因测试\"}")
    @RequestMapping(value = "/stateUp",method = RequestMethod.POST,produces="text/html;charset=UTF-8")
    @ResponseBody
    public String stateUp(@RequestBody FeedbackRequest request){
        String result;

        FeedbackBean feedbackBean = new FeedbackBean();
        feedbackBean.setPsFeedbackCode(request.getFeedbackCode());
        feedbackBean.setPsFeedbackState(request.getFeedbackState());
        feedbackBean.setPsFeedbackRemarks(request.getFeedbackRemarks());

        try {
            service.upState(feedbackBean);
            result = RespenseJsonTransformationUtil.jsonStr(ResultCode.CODE_SUCCESS, "操作成功", new HashMap());
        } catch (Exception e) {
            e.printStackTrace();
            result = RespenseJsonTransformationUtil.jsonStr(ResultCode.CODE_FAIL, e.getMessage(),new HashMap());
        }
        return result;
    }

    /**
     * 获取上报信息
     * 服务器访问路径：http://localhost:8080/bolg/feedback/getFeedbackInfo
     * 本地访问路径：http://localhost:8111/feedback/getFeedbackInfo
     * 参数：
     * {"feedbackCode":"FEED20241102142035"}
     */
    @ApiOperation(value = "获取上报信息", notes = "参数：{\"feedbackCode\":\"FEED20241102142035\"}", response = FeedbackResp.class)
    @RequestMapping(value = "/getFeedbackInfo",method = RequestMethod.POST, produces="text/html;charset=UTF-8")
    @ResponseBody
    public String getFeedbackInfo(@RequestBody FeedbackRequest request){
        String result;

        FeedbackBean feedbackBean = new FeedbackBean();
        feedbackBean.setPsFeedbackCode(request.getFeedbackCode());

        try {
            FeedbackBean returnBean = service.findOneByCode(feedbackBean);
            if (null != returnBean) {
                CustomerBean customerBean = new CustomerBean();
                customerBean.setPsCustomerCode(returnBean.getPsCustomerCode());
                CustomerBean returnCustomerBean = customerService.findOneByCode(customerBean);
                FeedbackResp resp = new FeedbackResp();
                resp.setFeedbackCode(returnBean.getPsFeedbackCode());
                resp.setCustomerCode(returnCustomerBean.getPsCustomerCode());
                resp.setCustomerName(returnCustomerBean.getPsCustomerName());
                resp.setCustomerUserName(returnCustomerBean.getPsCustomerUserName());
                resp.setCustomerUserPhone(returnCustomerBean.getPsCustomerUserPhone());
                resp.setFeedbackContent(returnBean.getPsFeedbackContent());
                resp.setFeedbackVoiceFile(returnBean.getPsFeedbackVoiceFile());
                resp.setFeedbackVideoFile(returnBean.getPsFeedbackVideoFile());
                resp.setFeedbackImgFile(returnBean.getPsFeedbackImgFile());
                resp.setFeedbackProvince(returnBean.getPsFeedbackProvince());
                resp.setFeedbackCity(returnBean.getPsFeedbackCity());
                resp.setFeedbackRegion(returnBean.getPsFeedbackRegion());
                resp.setFeedbackAddress(returnBean.getPsFeedbackAddress());
                resp.setFeedbackLongitude(returnBean.getPsFeedbackLongitude());
                resp.setFeedbackLatitude(returnBean.getPsFeedbackLatitude());
                resp.setFeedbackType(returnBean.getPsFeedbackType());
                resp.setFeedbackState(returnBean.getPsFeedbackState());
                resp.setFeedbackRemarks(returnBean.getPsFeedbackRemarks());
                if(!StringUtils.isEmpty(returnBean.getCreateDate())){
                    resp.setCreateDate(returnBean.getCreateDate().substring(0, returnBean.getCreateDate().indexOf(".")));
                }else{
                    resp.setCreateDate("");
                }
                if(!StringUtils.isEmpty(returnBean.getPsFeedbackHikFirstDate())){
                    resp.setFeedbackHikFirstDate(returnBean.getPsFeedbackHikFirstDate().substring(0, returnBean.getPsFeedbackHikFirstDate().indexOf(".")));
                }else{
                    resp.setFeedbackHikFirstDate("");
                }
                if(!StringUtils.isEmpty(returnBean.getPsFeedbackHikNewDate())){
                    resp.setFeedbackHikNewDate(returnBean.getPsFeedbackHikNewDate().substring(0, returnBean.getPsFeedbackHikNewDate().indexOf(".")));
                }else{
                    resp.setFeedbackHikNewDate("");
                }
                resp.setFeedbackHikAddress(returnBean.getPsFeedbackHikAddress());
                resp.setFeedbackHikDeviceType(returnBean.getPsFeedbackHikDeviceType());
                resp.setFeedbackHikDeviceSerial(returnBean.getPsFeedbackHikDeviceSerial());
                resp.setFeedbackClassification(returnBean.getPsFeedbackClassification());
                resp.setFeedbackGlance(returnBean.getPsFeedbackGlance());
                resp.setFeedbackGlanceServer(returnBean.getPsFeedbackGlanceServer());

                Map map = new HashMap();
                map.put("data", resp);
                result = RespenseJsonTransformationUtil.jsonStr(ResultCode.CODE_SUCCESS, "获取信息成功", map);
            } else {
                result = RespenseJsonTransformationUtil.jsonStr(ResultCode.CODE_FAIL,"暂无数据",new HashMap());
            }
        } catch (Exception e) {
            e.printStackTrace();
            result = RespenseJsonTransformationUtil.jsonStr(ResultCode.CODE_FAIL,e.getMessage(),new HashMap());
        }
        return result;
    }

    /**
     * 查询（分页）上报-支持客户（单位）编号、区域、类型、状态条件查询-条件字段可空（分页相关除外）
     * 服务器访问路径：http://localhost:8080/bolg/feedback/findAllByCondition
     * 本地访问路径：http://localhost:8111/feedback/findAllByCondition
     * 参数：
     * {"psCustomerCode":"CUS20241102102456","feedbackRegion":"九龙坡","feedbackType":1,"feedbackState":1,"feedbackClassification":1,"pageNum":"1","pageSize":"5"}
     */
    @ApiOperation(value = "查询（分页）上报-支持客户（单位）编号、区域、类型、状态、上报类型条件查询-条件字段可空（分页相关除外）", notes = "参数（feedbackType=3：不区分预警还是故障，feedbackState=-1：不区分状态，feedbackClassification=3：不区分上报来自海康还是业主）：{\"psCustomerCode\":\"CUS20241102102456\",\"feedbackRegion\":\"九龙坡\",\"feedbackType\":1,\"feedbackState\":1,\"feedbackClassification\":1,\"pageNum\":\"1\",\"pageSize\":\"5\"}", response = FeedbackResp.class)
    @RequestMapping(value = "/findAllByCondition",method = RequestMethod.POST,produces="text/html;charset=UTF-8")
    @ResponseBody
    public String findAllByCondition(@RequestBody FeedbackRequest request){
        Page pageInfo = PageHelper.startPage(request.getPageNum(), request.getPageSize());
        String result;

        FeedbackBean feedbackBean = new FeedbackBean();
        feedbackBean.setPsCustomerCode(request.getPsCustomerCode());
        feedbackBean.setPsFeedbackRegion(request.getFeedbackRegion());
        feedbackBean.setPsFeedbackType(request.getFeedbackType());
        feedbackBean.setPsFeedbackState(request.getFeedbackState());
        feedbackBean.setPsFeedbackClassification(request.getFeedbackClassification());

        try {
            List<FeedbackResp> respList = new ArrayList<>();

            for(FeedbackBean returnBean : service.findAllByCondition(feedbackBean)){
                CustomerBean customerBean = new CustomerBean();
                customerBean.setPsCustomerCode(returnBean.getPsCustomerCode());
                CustomerBean returnCustomerBean = customerService.findOneByCode(customerBean);
                FeedbackResp resp = new FeedbackResp();
                resp.setFeedbackCode(returnBean.getPsFeedbackCode());
                resp.setCustomerCode(returnCustomerBean.getPsCustomerCode());
                resp.setCustomerName(returnCustomerBean.getPsCustomerName());
                resp.setCustomerUserName(returnCustomerBean.getPsCustomerUserName());
                resp.setCustomerUserPhone(returnCustomerBean.getPsCustomerUserPhone());
                resp.setFeedbackContent(returnBean.getPsFeedbackContent());
                resp.setFeedbackVoiceFile(returnBean.getPsFeedbackVoiceFile());
                resp.setFeedbackVideoFile(returnBean.getPsFeedbackVideoFile());
                resp.setFeedbackImgFile(returnBean.getPsFeedbackImgFile());
                resp.setFeedbackProvince(returnBean.getPsFeedbackProvince());
                resp.setFeedbackCity(returnBean.getPsFeedbackCity());
                resp.setFeedbackRegion(returnBean.getPsFeedbackRegion());
                resp.setFeedbackAddress(returnBean.getPsFeedbackAddress());
                resp.setFeedbackLongitude(returnBean.getPsFeedbackLongitude());
                resp.setFeedbackLatitude(returnBean.getPsFeedbackLatitude());
                resp.setFeedbackType(returnBean.getPsFeedbackType());
                resp.setFeedbackState(returnBean.getPsFeedbackState());
                resp.setFeedbackRemarks(returnBean.getPsFeedbackRemarks());
                if(!StringUtils.isEmpty(returnBean.getCreateDate())){
                    resp.setCreateDate(returnBean.getCreateDate().substring(0, returnBean.getCreateDate().indexOf(".")));
                }else{
                    resp.setCreateDate("");
                }
                if(!StringUtils.isEmpty(returnBean.getPsFeedbackHikFirstDate())){
                    resp.setFeedbackHikFirstDate(returnBean.getPsFeedbackHikFirstDate().substring(0, returnBean.getPsFeedbackHikFirstDate().indexOf(".")));
                }else{
                    resp.setFeedbackHikFirstDate("");
                }
                if(!StringUtils.isEmpty(returnBean.getPsFeedbackHikNewDate())){
                    resp.setFeedbackHikNewDate(returnBean.getPsFeedbackHikNewDate().substring(0, returnBean.getPsFeedbackHikNewDate().indexOf(".")));
                }else{
                    resp.setFeedbackHikNewDate("");
                }
                resp.setFeedbackHikAddress(returnBean.getPsFeedbackHikAddress());
                resp.setFeedbackHikDeviceType(returnBean.getPsFeedbackHikDeviceType());
                resp.setFeedbackHikDeviceSerial(returnBean.getPsFeedbackHikDeviceSerial());
                resp.setFeedbackClassification(returnBean.getPsFeedbackClassification());
                resp.setFeedbackGlance(returnBean.getPsFeedbackGlance());
                resp.setFeedbackGlanceServer(returnBean.getPsFeedbackGlanceServer());
                respList.add(resp);
            }

            Map map = new HashMap();
            map.put("pageInfo", pageInfo);
            map.put("rows", respList);
            result = RespenseJsonTransformationUtil.jsonStr(ResultCode.CODE_SUCCESS, "查询成功", map);
        } catch (Exception e) {
            e.printStackTrace();
            result = RespenseJsonTransformationUtil.jsonStr(ResultCode.CODE_FAIL, e.getMessage(),new HashMap());
        }
        return result;
    }

    /**
     * 查询（分页）上报（包括留观）-支持客户（单位）编号、区域、类型、状态条件查询-条件字段可空（分页相关除外）
     * 服务器访问路径：http://localhost:8080/bolg/feedback/findAllByConditionToObserve
     * 本地访问路径：http://localhost:8111/feedback/findAllByConditionToObserve
     * 参数：
     * {"feedbackHikDeviceSerial":"D38019754","psCustomerCode":"CUS20241219000133","feedbackRegion":"","feedbackType":3,"feedbackState":-1,"feedbackClassification":1,"pageNum":"1","pageSize":"5"}
     */
    @ApiOperation(value = "查询（分页）上报（包括留观）-支持客户（单位）编号、区域、类型、上报类型条件查询-条件字段可空（分页相关除外）", notes = "参数（feedbackType=3：不区分预警还是故障，feedbackState=-1：不区分状态，feedbackClassification=3：不区分上报来自海康还是业主）：{\"feedbackHikDeviceSerial\":\"D38019754\",\"psCustomerCode\":\"CUS20241219000133\",\"feedbackRegion\":\"\",\"feedbackType\":3,\"feedbackState\":-1,\"feedbackClassification\":1,\"pageNum\":\"1\",\"pageSize\":\"5\"}", response = FeedbackResp.class)
    @RequestMapping(value = "/findAllByConditionToObserve",method = RequestMethod.POST,produces="text/html;charset=UTF-8")
    @ResponseBody
    public String findAllByConditionToObserve(@RequestBody FeedbackRequest request){
        Page pageInfo = PageHelper.startPage(request.getPageNum(), request.getPageSize());
        String result;

        FeedbackBean feedbackBean = new FeedbackBean();
        feedbackBean.setPsCustomerCode(request.getPsCustomerCode());
        feedbackBean.setPsFeedbackRegion(request.getFeedbackRegion());
        feedbackBean.setPsFeedbackType(request.getFeedbackType());
        feedbackBean.setPsFeedbackState(request.getFeedbackState());
        feedbackBean.setPsFeedbackClassification(request.getFeedbackClassification());
        feedbackBean.setPsFeedbackHikDeviceSerial(request.getFeedbackHikDeviceSerial());

        try {
            List<FeedbackResp> respList = new ArrayList<>();

            for(FeedbackBean returnBean : service.findAllByConditionToObserve(feedbackBean)){
                CustomerBean customerBean = new CustomerBean();
                customerBean.setPsCustomerCode(returnBean.getPsCustomerCode());
                CustomerBean returnCustomerBean = customerService.findOneByCode(customerBean);
                FeedbackResp resp = new FeedbackResp();
                resp.setFeedbackCode(returnBean.getPsFeedbackCode());
                resp.setCustomerCode(returnCustomerBean.getPsCustomerCode());
                resp.setCustomerName(returnCustomerBean.getPsCustomerName());
                resp.setCustomerUserName(returnCustomerBean.getPsCustomerUserName());
                resp.setCustomerUserPhone(returnCustomerBean.getPsCustomerUserPhone());
                resp.setFeedbackContent(returnBean.getPsFeedbackContent());
                resp.setFeedbackVoiceFile(returnBean.getPsFeedbackVoiceFile());
                resp.setFeedbackVideoFile(returnBean.getPsFeedbackVideoFile());
                resp.setFeedbackImgFile(returnBean.getPsFeedbackImgFile());
                resp.setFeedbackProvince(returnBean.getPsFeedbackProvince());
                resp.setFeedbackCity(returnBean.getPsFeedbackCity());
                resp.setFeedbackRegion(returnBean.getPsFeedbackRegion());
                resp.setFeedbackAddress(returnBean.getPsFeedbackAddress());
                resp.setFeedbackLongitude(returnBean.getPsFeedbackLongitude());
                resp.setFeedbackLatitude(returnBean.getPsFeedbackLatitude());
                resp.setFeedbackType(returnBean.getPsFeedbackType());
                resp.setFeedbackState(returnBean.getPsFeedbackState());
                resp.setFeedbackRemarks(returnBean.getPsFeedbackRemarks());
                if(!StringUtils.isEmpty(returnBean.getCreateDate())){
                    resp.setCreateDate(returnBean.getCreateDate().substring(0, returnBean.getCreateDate().indexOf(".")));
                }else{
                    resp.setCreateDate("");
                }
                if(!StringUtils.isEmpty(returnBean.getPsFeedbackHikFirstDate())){
                    resp.setFeedbackHikFirstDate(returnBean.getPsFeedbackHikFirstDate().substring(0, returnBean.getPsFeedbackHikFirstDate().indexOf(".")));
                }else{
                    resp.setFeedbackHikFirstDate("");
                }
                if(!StringUtils.isEmpty(returnBean.getPsFeedbackHikNewDate())){
                    resp.setFeedbackHikNewDate(returnBean.getPsFeedbackHikNewDate().substring(0, returnBean.getPsFeedbackHikNewDate().indexOf(".")));
                }else{
                    resp.setFeedbackHikNewDate("");
                }
                resp.setFeedbackHikAddress(returnBean.getPsFeedbackHikAddress());
                resp.setFeedbackHikDeviceType(returnBean.getPsFeedbackHikDeviceType());
                resp.setFeedbackHikDeviceSerial(returnBean.getPsFeedbackHikDeviceSerial());
                resp.setFeedbackClassification(returnBean.getPsFeedbackClassification());
                resp.setFeedbackGlance(returnBean.getPsFeedbackGlance());
                resp.setFeedbackGlanceServer(returnBean.getPsFeedbackGlanceServer());
                respList.add(resp);
            }

            Map map = new HashMap();
            map.put("pageInfo", pageInfo);
            map.put("rows", respList);
            result = RespenseJsonTransformationUtil.jsonStr(ResultCode.CODE_SUCCESS, "查询成功", map);
        } catch (Exception e) {
            e.printStackTrace();
            result = RespenseJsonTransformationUtil.jsonStr(ResultCode.CODE_FAIL, e.getMessage(),new HashMap());
        }
        return result;
    }

    /**
     * 查询（分页）上报（待处置、留观）-支持客户（单位）编号、区域、类型、状态条件查询-条件字段可空（分页相关除外）
     * 服务器访问路径：http://localhost:8080/bolg/feedback/findAllByConditionToObserveNew
     * 本地访问路径：http://localhost:8111/feedback/findAllByConditionToObserveNew
     * 参数：
     * {"feedbackHikDeviceSerial":"D38019754","psCustomerCode":"CUS20241219000133","feedbackRegion":"","feedbackType":3,"feedbackClassification":1,"pageNum":"1","pageSize":"5"}
     */
    @ApiOperation(value = "查询（分页）上报（待处置、留观）-支持客户（单位）编号、区域、类型、上报类型条件查询-条件字段可空（分页相关除外）", notes = "参数（feedbackType=3：不区分预警还是故障，feedbackClassification=3：不区分上报来自海康还是业主）：{\"feedbackHikDeviceSerial\":\"D38019754\",\"psCustomerCode\":\"CUS20241219000133\",\"feedbackRegion\":\"\",\"feedbackType\":3,\"feedbackClassification\":1,\"pageNum\":\"1\",\"pageSize\":\"5\"}", response = FeedbackResp.class)
    @RequestMapping(value = "/findAllByConditionToObserveNew",method = RequestMethod.POST,produces="text/html;charset=UTF-8")
    @ResponseBody
    public String findAllByConditionToObserveNew(@RequestBody FeedbackRequest request){
        Page pageInfo = PageHelper.startPage(request.getPageNum(), request.getPageSize());
        String result;

        FeedbackBean feedbackBean = new FeedbackBean();
        feedbackBean.setPsCustomerCode(request.getPsCustomerCode());
        feedbackBean.setPsFeedbackRegion(request.getFeedbackRegion());
        feedbackBean.setPsFeedbackType(request.getFeedbackType());
        feedbackBean.setPsFeedbackClassification(request.getFeedbackClassification());
        feedbackBean.setPsFeedbackHikDeviceSerial(request.getFeedbackHikDeviceSerial());

        try {
            List<FeedbackResp> respList = new ArrayList<>();

            for(FeedbackBean returnBean : service.findAllByConditionToObserveNew(feedbackBean)){
                CustomerBean customerBean = new CustomerBean();
                customerBean.setPsCustomerCode(returnBean.getPsCustomerCode());
                CustomerBean returnCustomerBean = customerService.findOneByCode(customerBean);
                FeedbackResp resp = new FeedbackResp();
                resp.setFeedbackCode(returnBean.getPsFeedbackCode());
                resp.setCustomerCode(returnCustomerBean.getPsCustomerCode());
                resp.setCustomerName(returnCustomerBean.getPsCustomerName());
                resp.setCustomerUserName(returnCustomerBean.getPsCustomerUserName());
                resp.setCustomerUserPhone(returnCustomerBean.getPsCustomerUserPhone());
                resp.setFeedbackContent(returnBean.getPsFeedbackContent());
                resp.setFeedbackVoiceFile(returnBean.getPsFeedbackVoiceFile());
                resp.setFeedbackVideoFile(returnBean.getPsFeedbackVideoFile());
                resp.setFeedbackImgFile(returnBean.getPsFeedbackImgFile());
                resp.setFeedbackProvince(returnBean.getPsFeedbackProvince());
                resp.setFeedbackCity(returnBean.getPsFeedbackCity());
                resp.setFeedbackRegion(returnBean.getPsFeedbackRegion());
                resp.setFeedbackAddress(returnBean.getPsFeedbackAddress());
                resp.setFeedbackLongitude(returnBean.getPsFeedbackLongitude());
                resp.setFeedbackLatitude(returnBean.getPsFeedbackLatitude());
                resp.setFeedbackType(returnBean.getPsFeedbackType());
                resp.setFeedbackState(returnBean.getPsFeedbackState());
                resp.setFeedbackRemarks(returnBean.getPsFeedbackRemarks());
                if(!StringUtils.isEmpty(returnBean.getCreateDate())){
                    resp.setCreateDate(returnBean.getCreateDate().substring(0, returnBean.getCreateDate().indexOf(".")));
                }else{
                    resp.setCreateDate("");
                }
                if(!StringUtils.isEmpty(returnBean.getPsFeedbackHikFirstDate())){
                    resp.setFeedbackHikFirstDate(returnBean.getPsFeedbackHikFirstDate().substring(0, returnBean.getPsFeedbackHikFirstDate().indexOf(".")));
                }else{
                    resp.setFeedbackHikFirstDate("");
                }
                if(!StringUtils.isEmpty(returnBean.getPsFeedbackHikNewDate())){
                    resp.setFeedbackHikNewDate(returnBean.getPsFeedbackHikNewDate().substring(0, returnBean.getPsFeedbackHikNewDate().indexOf(".")));
                }else{
                    resp.setFeedbackHikNewDate("");
                }
                resp.setFeedbackHikAddress(returnBean.getPsFeedbackHikAddress());
                resp.setFeedbackHikDeviceType(returnBean.getPsFeedbackHikDeviceType());
                resp.setFeedbackHikDeviceSerial(returnBean.getPsFeedbackHikDeviceSerial());
                resp.setFeedbackClassification(returnBean.getPsFeedbackClassification());
                resp.setFeedbackGlance(returnBean.getPsFeedbackGlance());
                resp.setFeedbackGlanceServer(returnBean.getPsFeedbackGlanceServer());
                respList.add(resp);
            }

            Map map = new HashMap();
            map.put("pageInfo", pageInfo);
            map.put("rows", respList);
            result = RespenseJsonTransformationUtil.jsonStr(ResultCode.CODE_SUCCESS, "查询成功", map);
        } catch (Exception e) {
            e.printStackTrace();
            result = RespenseJsonTransformationUtil.jsonStr(ResultCode.CODE_FAIL, e.getMessage(),new HashMap());
        }
        return result;
    }

    /**
     * 获取海康报警信息统计数据
     * 服务器访问路径：http://localhost:8080/bolg/feedback/getHikWaringStatistics
     * 本地访问路径：http://localhost:8111/feedback/getHikWaringStatistics
     * 参数：
     */
    @ApiOperation(value = "获取报警信息统计数据", response = FeedbackHikWaringStatisticsResp.class)
    @RequestMapping(value = "/getHikWaringStatistics",method = RequestMethod.POST,produces="text/html;charset=UTF-8")
    @ResponseBody
    public String getHikWaringStatistics(){
        String result;
        try {
            FeedbackHikWaringStatisticsResp resp = new FeedbackHikWaringStatisticsResp();

            List<FeedbackBean> returnAllBeans = service.findAllByHikWaring();

            int allWaringProcessedNum = 0;
            int allWaringUntreatedNum = 0;
            int allWaringTodayNum = 0;
            int allWaringTodayProcessedNum = 0;
            int allWaringTodayUntreatedNum = 0;

            if(null != returnAllBeans && returnAllBeans.size() != 0){
                for(FeedbackBean fb: returnAllBeans){
                    if(fb.getCreateDate().substring(0,10).equals(DateUtil.getCustomizedSystemDate("yyyy-MM-dd"))){
                        allWaringTodayNum += 1;
                        if(fb.getPsFeedbackState() == 1){
                            allWaringTodayUntreatedNum += 1;
                        }else{
                            allWaringTodayProcessedNum += 1;
                        }
                    }
                }

                for(FeedbackBean fb: returnAllBeans){
                    if(fb.getPsFeedbackState() == 1){
                        allWaringUntreatedNum += 1;
                    }else{
                        allWaringProcessedNum += 1;
                    }
                }
                resp.setAllWaringNum(returnAllBeans.size());
                resp.setAllWaringProcessedNum(allWaringProcessedNum);
                resp.setAllWaringUntreatedNum(allWaringUntreatedNum);
                resp.setAllWaringTodayNum(allWaringTodayNum);
                resp.setAllWaringTodayProcessedNum(allWaringTodayProcessedNum);
                resp.setAllWaringTodayUntreatedNum(allWaringTodayUntreatedNum);
            }else{
                resp.setAllWaringNum(0);
                resp.setAllWaringProcessedNum(0);
                resp.setAllWaringUntreatedNum(0);
                resp.setAllWaringTodayNum(0);
                resp.setAllWaringTodayProcessedNum(0);
                resp.setAllWaringTodayUntreatedNum(0);
            }

            Map map = new HashMap();
            map.put("data",resp);
            result = RespenseJsonTransformationUtil.jsonStr(ResultCode.CODE_SUCCESS, "查询成功", map);
        } catch (Exception e) {
            e.printStackTrace();
            result = RespenseJsonTransformationUtil.jsonStr(ResultCode.CODE_FAIL, e.getMessage(),new HashMap());
        }
        return result;
    }

    /**
     * 获取海康故障信息统计数据
     * 服务器访问路径：http://localhost:8080/bolg/feedback/getHikFaultStatistics
     * 本地访问路径：http://localhost:8111/feedback/getHikFaultStatistics
     * 参数：
     */
    @ApiOperation(value = "获取海康故障信息统计数据", response = FeedbackHikFaultStatisticsResp.class)
    @RequestMapping(value = "/getHikFaultStatistics",method = RequestMethod.POST,produces="text/html;charset=UTF-8")
    @ResponseBody
    public String getHikFaultStatistics(){
        String result;
        try {
            FeedbackHikFaultStatisticsResp resp = new FeedbackHikFaultStatisticsResp();

            List<FeedbackBean> returnAllBeans = service.findAllByHikFault();

            int allFaultProcessedNum = 0;
            int allFaultUntreatedNum = 0;
            int allFaultTodayNum = 0;
            int allFaultTodayProcessedNum = 0;
            int allFaultTodayUntreatedNum = 0;

            if(null != returnAllBeans && returnAllBeans.size() != 0){
                for(FeedbackBean fb: returnAllBeans){
                    if(fb.getCreateDate().substring(0,10).equals(DateUtil.getCustomizedSystemDate("yyyy-MM-dd"))){
                        allFaultTodayNum += 1;
                        if(fb.getPsFeedbackState() == 1){
                            allFaultTodayUntreatedNum += 1;
                        }else{
                            allFaultTodayProcessedNum += 1;
                        }
                    }
                }

                for(FeedbackBean fb: returnAllBeans){
                    if(fb.getPsFeedbackState() == 1){
                        allFaultUntreatedNum += 1;
                    }else{
                        allFaultProcessedNum += 1;
                    }
                }

                resp.setAllFaultNum(returnAllBeans.size());
                resp.setAllFaultProcessedNum(allFaultProcessedNum);
                resp.setAllFaultUntreatedNum(allFaultUntreatedNum);
                resp.setAllFaultTodayNum(allFaultTodayNum);
                resp.setAllFaultTodayProcessedNum(allFaultTodayProcessedNum);
                resp.setAllFaultTodayUntreatedNum(allFaultTodayUntreatedNum);
            }else{
                resp.setAllFaultNum(0);
                resp.setAllFaultProcessedNum(0);
                resp.setAllFaultUntreatedNum(0);
                resp.setAllFaultTodayNum(0);
                resp.setAllFaultTodayProcessedNum(0);
                resp.setAllFaultTodayUntreatedNum(0);
            }

            Map map = new HashMap();
            map.put("data",resp);
            result = RespenseJsonTransformationUtil.jsonStr(ResultCode.CODE_SUCCESS, "查询成功", map);
        } catch (Exception e) {
            e.printStackTrace();
            result = RespenseJsonTransformationUtil.jsonStr(ResultCode.CODE_FAIL, e.getMessage(),new HashMap());
        }
        return result;
    }

    /**
     * 获取海康报警和故障信息状态统计
     * 服务器访问路径：http://localhost:8080/bolg/feedback/getHikFeedbackStatistics
     * 本地访问路径：http://localhost:8111/feedback/getHikFeedbackStatistics
     * 参数：{"psCustomerCode":"CUS20241219000133","feedbackType":1}
     */
    @ApiOperation(value = "获取海康报警和故障信息状态统计", notes = "参数：{\"psCustomerCode\":\"CUS20241219000133\",\"feedbackType\":1}", response = FeedbackHikFaultStatisticsResp.class)
    @RequestMapping(value = "/getHikFeedbackStatistics",method = RequestMethod.POST,produces="text/html;charset=UTF-8")
    @ResponseBody
    public String getHikFeedbackStatistics(@RequestBody FeedbackRequest request){
        String result;
        try {
            FeedbackBean feedbackBean = new FeedbackBean();
            feedbackBean.setPsCustomerCode(request.getPsCustomerCode());
            feedbackBean.setPsFeedbackType(request.getFeedbackType());
            feedbackBean.setPsFeedbackClassification(1);

            List<FeedbackBean> returnAllBeans = service.findAllByCondition(feedbackBean);

            HikFeedbackStatisticsResp hfsResp = new HikFeedbackStatisticsResp();
            int pendingNum = 0;
            int rejectNum = 0;
            int observeNum = 0;
            int handledNum = 0;

            if(null != returnAllBeans && returnAllBeans.size() != 0){
                for(FeedbackBean fb: returnAllBeans){
                    if(fb.getPsFeedbackState() == 1){
                        pendingNum += 1;
                    } else if(fb.getPsFeedbackState() == 2){
                        rejectNum += 1;
                    } else if(fb.getPsFeedbackState() == 3){
                        observeNum += 1;
                    } else if(fb.getPsFeedbackState() == 4){
                        handledNum += 1;
                    }
                }
                hfsResp.setPendingNum(pendingNum);
                hfsResp.setRejectNum(rejectNum);
                hfsResp.setObserveNum(observeNum);
                hfsResp.setHandledNum(handledNum);
            }else{
                hfsResp.setPendingNum(0);
                hfsResp.setRejectNum(0);
                hfsResp.setObserveNum(0);
                hfsResp.setHandledNum(0);
            }

            Map map = new HashMap();
            map.put("data",hfsResp);
            result = RespenseJsonTransformationUtil.jsonStr(ResultCode.CODE_SUCCESS, "查询成功", map);
        } catch (Exception e) {
            e.printStackTrace();
            result = RespenseJsonTransformationUtil.jsonStr(ResultCode.CODE_FAIL, e.getMessage(),new HashMap());
        }
        return result;
    }

    /**
     * 获取我的上报信息状态统计
     * 服务器访问路径：http://localhost:8080/bolg/feedback/getFeedbackStatistics
     * 本地访问路径：http://localhost:8111/feedback/getFeedbackStatistics
     * 参数：{"psCustomerCode":"CUS20241219000133"}
     */
    @ApiOperation(value = "获取我的上报信息状态统计", notes = "参数：{\"psCustomerCode\":\"CUS20241219000133\"}", response = FeedbackHikFaultStatisticsResp.class)
    @RequestMapping(value = "/getFeedbackStatistics",method = RequestMethod.POST,produces="text/html;charset=UTF-8")
    @ResponseBody
    public String getFeedbackStatistics(@RequestBody FeedbackRequest request){
        String result;
        try {
            FeedbackBean feedbackBean = new FeedbackBean();
            feedbackBean.setPsCustomerCode(request.getPsCustomerCode());
            feedbackBean.setPsFeedbackType(3);
            feedbackBean.setPsFeedbackClassification(2);

            List<FeedbackBean> returnAllBeans = service.findAllByCondition(feedbackBean);

            FeedbackStatisticsResp hfsResp = new FeedbackStatisticsResp();
            int pendingNum = 0;
            int rejectNum = 0;
            int observeNum = 0;
            int handledNum = 0;

            if(null != returnAllBeans && returnAllBeans.size() != 0){
                for(FeedbackBean fb: returnAllBeans){
                    if(fb.getPsFeedbackState() == 1){
                        pendingNum += 1;
                    } else if(fb.getPsFeedbackState() == 2){
                        rejectNum += 1;
                    } else if(fb.getPsFeedbackState() == 3){
                        observeNum += 1;
                    } else if(fb.getPsFeedbackState() == 4){
                        handledNum += 1;
                    }
                }
                hfsResp.setPendingNum(pendingNum);
                hfsResp.setRejectNum(rejectNum);
                hfsResp.setObserveNum(observeNum);
                hfsResp.setHandledNum(handledNum);
            }else{
                hfsResp.setPendingNum(0);
                hfsResp.setRejectNum(0);
                hfsResp.setObserveNum(0);
                hfsResp.setHandledNum(0);
            }

            Map map = new HashMap();
            map.put("data",hfsResp);
            result = RespenseJsonTransformationUtil.jsonStr(ResultCode.CODE_SUCCESS, "查询成功", map);
        } catch (Exception e) {
            e.printStackTrace();
            result = RespenseJsonTransformationUtil.jsonStr(ResultCode.CODE_FAIL, e.getMessage(),new HashMap());
        }
        return result;
    }

    /**
     * 后台系统数据统计-近7天海康上报趋势
     * 服务器访问路径：http://localhost:8080/bolg/feedback/getFeedbackHikStatisticsWeek
     * 本地访问路径：http://localhost:8111/feedback/getFeedbackHikStatisticsWeek
     */
    @ApiOperation(value = "后台系统数据统计-近7天海康上报趋势", response = com.yy.bolg.resp.statistics.admin.FeedbackStatisticsResp.class)
    @RequestMapping(value = "/getFeedbackHikStatisticsWeek",method = RequestMethod.POST,produces="text/html;charset=UTF-8")
    @ResponseBody
    public String getFeedbackHikStatisticsWeek(@RequestBody FeedbackRequest request){
        String result;
        try {
            List<FeedbackBean> returnAllBeans = service.findAllByHikWeek();
            List<String> datas = DateUtil.getSevenDate();

            List<com.yy.bolg.resp.statistics.admin.FeedbackStatisticsResp> feedbackStatisticsResps = new ArrayList<>();

            if(null != returnAllBeans && returnAllBeans.size() != 0){
                for(String data: datas){
                    com.yy.bolg.resp.statistics.admin.FeedbackStatisticsResp itemResp = new com.yy.bolg.resp.statistics.admin.FeedbackStatisticsResp();
                    int feedbackNum = 0;
                    for(FeedbackBean fb: returnAllBeans){
                        if(data.equals(fb.getCreateDate().substring(0,10))){
                            feedbackNum += 1;
                        }
                    }
                    itemResp.setDateStr(data);
                    itemResp.setFeedbackNum(feedbackNum);
                    feedbackStatisticsResps.add(itemResp);
                }
            }

            Map map = new HashMap();
            map.put("data", feedbackStatisticsResps);
            result = RespenseJsonTransformationUtil.jsonStr(ResultCode.CODE_SUCCESS, "查询成功", map);
        } catch (Exception e) {
            e.printStackTrace();
            result = RespenseJsonTransformationUtil.jsonStr(ResultCode.CODE_FAIL, e.getMessage(),new HashMap());
        }
        return result;
    }

    /**
     * 后台系统数据统计-近7天业主上报趋势
     * 服务器访问路径：http://localhost:8080/bolg/feedback/getFeedbackCustomerStatisticsWeek
     * 本地访问路径：http://localhost:8111/feedback/getFeedbackCustomerStatisticsWeek
     */
    @ApiOperation(value = "后台系统数据统计-近7天业主上报趋势", response = com.yy.bolg.resp.statistics.admin.FeedbackStatisticsResp.class)
    @RequestMapping(value = "/getFeedbackCustomerStatisticsWeek",method = RequestMethod.POST,produces="text/html;charset=UTF-8")
    @ResponseBody
    public String getFeedbackCustomerStatisticsWeek(@RequestBody FeedbackRequest request){
        String result;
        try {
            List<FeedbackBean> returnAllBeans = service.findAllByCustomerWeek();
            List<String> datas = DateUtil.getSevenDate();

            List<com.yy.bolg.resp.statistics.admin.FeedbackStatisticsResp> feedbackStatisticsResps = new ArrayList<>();

            if(null != returnAllBeans && returnAllBeans.size() != 0){
                for(String data: datas){
                    com.yy.bolg.resp.statistics.admin.FeedbackStatisticsResp itemResp = new com.yy.bolg.resp.statistics.admin.FeedbackStatisticsResp();
                    int feedbackNum = 0;
                    for(FeedbackBean fb: returnAllBeans){
                        if(data.equals(fb.getCreateDate().substring(0,10))){
                            feedbackNum += 1;
                        }
                    }
                    itemResp.setDateStr(data);
                    itemResp.setFeedbackNum(feedbackNum);
                    feedbackStatisticsResps.add(itemResp);
                }
            }

            Map map = new HashMap();
            map.put("data", feedbackStatisticsResps);
            result = RespenseJsonTransformationUtil.jsonStr(ResultCode.CODE_SUCCESS, "查询成功", map);
        } catch (Exception e) {
            e.printStackTrace();
            result = RespenseJsonTransformationUtil.jsonStr(ResultCode.CODE_FAIL, e.getMessage(),new HashMap());
        }
        return result;
    }

    /**
     * 查询未读条数
     * 服务器访问路径：http://localhost:8080/bolg/feedback/findUnread
     * 本地访问路径：http://localhost:8111/feedback/findUnread
     * 参数：
     * {"psCustomerCode":"CUS20241224151636"}
     */
    @ApiOperation(value = "查询未读条数", notes = "参数：{\"psCustomerCode\":\"CUS20241224151636\"}", response = MsgInspectResp.class)
    @RequestMapping(value = "/findUnread",method = RequestMethod.POST,produces="text/html;charset=UTF-8")
    @ResponseBody
    public String findUnread(@RequestBody FeedbackRequest request){
        String result;

        try {
            FeedbackBean feedbackBean = new FeedbackBean();
            feedbackBean.setPsCustomerCode(request.getPsCustomerCode());

            MsgInspectResp resp = new MsgInspectResp();

            List<FeedbackBean> feedbackBeanList;
            feedbackBeanList = service.findUnread(feedbackBean);

            resp.setUnreadNum(feedbackBeanList.size());

            Map map = new HashMap();
            map.put("data", resp);

            result = RespenseJsonTransformationUtil.jsonStr(ResultCode.CODE_SUCCESS, "查询成功", map);
        } catch (Exception e) {
            e.printStackTrace();
            result = RespenseJsonTransformationUtil.jsonStr(ResultCode.CODE_FAIL, e.getMessage(),new HashMap());
        }
        return result;
    }

    /**
     * 一键已读
     * 服务器访问路径：http://localhost:8080/bolg/feedback/upUnread
     * 本地访问路径：http://localhost:8111/feedback/upUnread
     * 参数：
     * {"psCustomerCode":"CUS20241224151636"}
     */
    @ApiOperation(value = "一键已读", notes = "参数：{\"psCustomerCode\":\"CUS20241224151636\"}")
    @RequestMapping(value = "/upUnread",method = RequestMethod.POST,produces="text/html;charset=UTF-8")
    @ResponseBody
    public String upUnread(@RequestBody FeedbackRequest request){
        String result;

        try {
            FeedbackBean feedbackBean = new FeedbackBean();
            feedbackBean.setPsCustomerCode(request.getPsCustomerCode());

            service.upUnread(feedbackBean);
            result = RespenseJsonTransformationUtil.jsonStr(ResultCode.CODE_SUCCESS, "一键已读成功", new HashMap());
        } catch (Exception e) {
            e.printStackTrace();
            result = RespenseJsonTransformationUtil.jsonStr(ResultCode.CODE_FAIL, e.getMessage(),new HashMap());
        }
        return result;
    }

    /**
     * 修改指定上报为已读
     * 服务器访问路径：http://localhost:8080/bolg/feedback/upAppointUnread
     * 本地访问路径：http://localhost:8111/feedback/upAppointUnread
     * 参数：
     * {"feedbackCode":"FEED20250305203909122685","psCustomerCode":"CUS20241224151636"}
     */
    @ApiOperation(value = "修改指定上报为已读", notes = "参数：{\"feedbackCode\":\"FEED20250305203909122685\",\"psCustomerCode\":\"CUS20241224151636\"}")
    @RequestMapping(value = "/upAppointUnread",method = RequestMethod.POST,produces="text/html;charset=UTF-8")
    @ResponseBody
    public String upAppointUnread(@RequestBody FeedbackRequest request){
        String result;

        try {
            FeedbackBean feedbackBean = new FeedbackBean();
            feedbackBean.setPsFeedbackCode(request.getFeedbackCode());
            feedbackBean.setPsCustomerCode(request.getPsCustomerCode());

            service.upAppointUnread(feedbackBean);
            result = RespenseJsonTransformationUtil.jsonStr(ResultCode.CODE_SUCCESS, "修改已读成功", new HashMap());
        } catch (Exception e) {
            e.printStackTrace();
            result = RespenseJsonTransformationUtil.jsonStr(ResultCode.CODE_FAIL, e.getMessage(),new HashMap());
        }
        return result;
    }

    /**
     * 修改指定上报为已读（后端系统用）
     * 服务器访问路径：http://localhost:8080/bolg/feedback/upAppointUnreadBackend
     * 本地访问路径：http://localhost:8111/feedback/upAppointUnreadBackend
     * 参数：
     * {"feedbackCode":"FEED20250305203909122685"}
     */
    @ApiOperation(value = "修改指定上报为已读（后端系统用）", notes = "参数：{\"feedbackCode\":\"FEED20250305203909122685\"}")
    @RequestMapping(value = "/upAppointUnreadBackend",method = RequestMethod.POST,produces="text/html;charset=UTF-8")
    @ResponseBody
    public String upAppointUnreadBackend(@RequestBody FeedbackRequest request){
        String result;

        try {
            FeedbackBean feedbackBean = new FeedbackBean();
            feedbackBean.setPsFeedbackCode(request.getFeedbackCode());

            service.upAppointUnreadBackend(feedbackBean);
            result = RespenseJsonTransformationUtil.jsonStr(ResultCode.CODE_SUCCESS, "修改已读成功", new HashMap());
        } catch (Exception e) {
            e.printStackTrace();
            result = RespenseJsonTransformationUtil.jsonStr(ResultCode.CODE_FAIL, e.getMessage(),new HashMap());
        }
        return result;
    }

    /**
     * 查询未读条数（后端系统用）
     * 服务器访问路径：http://localhost:8080/bolg/feedback/findUnreadBackend
     * 本地访问路径：http://localhost:8111/feedback/findUnreadBackend
     * 参数：
     * {"feedbackType":1}
     */
    @ApiOperation(value = "查询未读条数（后端系统用）", notes = "参数：{\"feedbackType\":1}", response = MsgInspectResp.class)
    @RequestMapping(value = "/findUnreadBackend",method = RequestMethod.POST,produces="text/html;charset=UTF-8")
    @ResponseBody
    public String findUnreadBackend(@RequestBody FeedbackRequest request){
        String result;

        try {
            FeedbackBean feedbackBean = new FeedbackBean();
            feedbackBean.setPsFeedbackType(request.getFeedbackType());

            MsgInspectResp resp = new MsgInspectResp();

            List<FeedbackBean> feedbackBeanList;
            feedbackBeanList = service.findUnreadBackend(feedbackBean);

            resp.setUnreadNum(feedbackBeanList.size());

            Map map = new HashMap();
            map.put("data", resp);

            result = RespenseJsonTransformationUtil.jsonStr(ResultCode.CODE_SUCCESS, "查询成功", map);
        } catch (Exception e) {
            e.printStackTrace();
            result = RespenseJsonTransformationUtil.jsonStr(ResultCode.CODE_FAIL, e.getMessage(),new HashMap());
        }
        return result;
    }

}
